"""
@Author: 霍格沃兹测试开发学社-西西
@Desc: 更多测试开发技术探讨，请访问：https://ceshiren.com/t/topic/15860
"""
"""
人类： 属性和方法

属性：性别，姓名，身高，体重，肤色
方法：跑、吃、学、喝、睡
"""


# class Human:
#     # 定义属性（类属性）
#     message = "这是类属性"
#     # 构造方法
#     def __init__(self, name, age):
#         # 实例变量
#         self.name = name
#         self.age = age
#         print("这是构造方法")
#
# human1 = Human("小霍",20)
# print(human1)

'''工具类'''
class Utils:

    # 类方法
    @classmethod
    def read_file(cls):
        print("读取yaml文件")
        print("获得响应数据")

Utils.read_file()
# util = Utils()
# util.read_file()


class Person:
    # 1. 类属性
    gender= ""
    name=""
    height=""
    weight=""
    color=""

    def __init__(self, name,gender,height,weight,color):
        '''构造方法'''
        # self.name 实例变量
        self.name = name
        self.gender = gender
        self.height = height
        self.weight = weight
        self.color = color

    @classmethod
    def born(cls):
        print("这是类方法")

    # 2. 实例方法
    def code(self):
        print(f"{self.name}在编码>>>>>>>")

    def run(self):
        print(f"{self.name}在奔跑~~~~")

    def eat(self):
        print(f"{self.name}在吃")

    def study(self):
        print("学习")

    def drink(self):
        print("喝")
    def sleep(self):
        print("睡觉")

# 类名直接访问 类方法
Person.born()

# 类名访问 类属性
# print(f"Person.name <{Person.name}>")
# 创建一个人
# 实例对象
peron1 = Person("小霍",'male',180,180,'yellow')
print(peron1)
print(peron1.name)
print(peron1.gender)
peron1.code()
peron1.run()
peron1.eat()

# peron1.name="小霍"
# peron1.height=180
# peron1.weight=180
# peron1.color='yellow'
# peron1.gender = 'male'
# print(peron1)
# print(peron1.name)
#
#
# peron2 = Person()
# peron2.name="小格"
# peron2.gender="female"
# peron1.height=160
# peron1.weight=120
# peron1.color='white'
# print(peron2)
# print(peron2.name)


